/**
* @description: 周赛311 t2
* @author hewei
* @date 2022/9/18 10:36
* @version 1.0
*/

public class LongestContinuousSubstring {

    public int longestContinuousSubstring(String s) {
        int ans = 0;
        int temp = 0;
        for (int i = 1; i < s.length(); i++) {
            char c1 = s.charAt(i - 1);
            char c2 = s.charAt(i);
            if (c2 - c1 != 1) {
                ans = Math.max(ans, i - 1 - temp + 1);
                temp = i;
            }
        }
        ans = Math.max(ans, s.length() - 1 - temp + 1);
        return ans;
    }
}
